package com.nuoniu.sibanyun.controller.crm;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nuoniu.sibanyun.common.BaseController;
import com.nuoniu.sibanyun.common.lang.DateUtils;
import com.nuoniu.sibanyun.common.result.HttpResult;
import com.nuoniu.sibanyun.entity.crm.Approval;
import com.nuoniu.sibanyun.service.crm.IApprovalService;
import com.nuoniu.sibanyun.userThread.UserInfo;
import com.nuoniu.sibanyun.userThread.UserThreadLocal;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 审批记录 前端控制器
 * </p>
 *
 * @author baiqiang
 * @since 2020-06-20
 */
@RestController
@RequestMapping("/work/approval")
@Api(tags = "审批记录")
public class ApprovalController extends BaseController {

    @Autowired
    private IApprovalService approvalService;

    /**
     * 获取审批记录
     * @author 小啊刚
     * @date 2020/7/10
     */
    @GetMapping("page")
    public HttpResult pageApproval(Page page, Approval approval) {
        return HttpResult.ok(approvalService.pageApproval(page, approval));
    }

    /**
     * 流程审核
     * @return
     */
    @PostMapping(value = "save")
    public HttpResult approvalAll(String ids, Integer type, String content) {
        approvalService.approvalAll(ids, type, content);
        return HttpResult.ok("审核完成！");
    }
}
